<?php

namespace ltcms\lib;

/**
 * 安装检测
 */
class Install
{
    private static $_instance;
    protected $lang=array();

    private function __construct(){}
    private function __clone(){ }

    /**
     * 安装检测
     */
    public function check(){
        $installDir=LTCMS_ROOT."/plugins/ltcms_install";
        $installedFile=LTCMS_ROOT."/plugins/ltcms_install/installed";
        if(is_dir($installDir) && !is_file($installedFile)){
            $controller=request()->pathinfo();
            $pathMap=explode("/",$controller);
            if($pathMap && $pathMap[0] !="install"){
                header('Location:/install');
                exit(0);
            }
        }
    }

    /**
     * 获取类对象
     */
    public static  function getInstance(){
        if(!(self::$_instance instanceof self)){
            self::$_instance=new self();
        }
        return self::$_instance;
    }
}